package top.lishuoboy.ssm;

import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
import top.lishuoboy.ssm.config.SpringConfig;
import top.lishuoboy.ssm.config.SpringMvcConfig;

/**
 * 继承关系：
 * WebApplicationInitializer
 * AbstractContextLoaderInitializer
 * AbstractDispatcherServletInitializer
 * AbstractAnnotationConfigDispatcherServletInitializer
 * WebAppConfig
 */
public class WebAppConfig extends AbstractAnnotationConfigDispatcherServletInitializer {
    @Override
    protected Class<?>[] getRootConfigClasses() {
        return new Class[]{SpringConfig.class};
    }

    @Override
    protected Class<?>[] getServletConfigClasses() {
        return new Class[]{SpringMvcConfig.class};
    }

    @Override
    protected String[] getServletMappings() {
        // 设置springMVC的核心控制器所能处理的请求的请求路径
        // /所匹配的请求可以是/login或.html或.js或.css方式的请求路径。但是/不能匹配.jsp请求路径的请求
        // /*匹配的请求,包括jsp
        return new String[]{"/"};
    }
}